package com.chenjun.mysite.module.sys.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.chenjun.mysite.common.ControllerUtil;
import com.chenjun.mysite.common.Page;
import com.chenjun.mysite.module.sys.entity.MenuCategory;
import com.chenjun.mysite.module.sys.service.MenuCategoryService;

import java.util.List;
import java.util.Map;

public class MenuController 
{
	private MenuCategoryService menuCategoryService = new MenuCategoryService();;
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{
		doPost(request,response);
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
	{
		String action = request.getParameter("action");
		switch(action)
		{
		case "list":
			this.list(request, response);
			break;
		case "form":
			this.form(request, response);
		break;
		default:
			this.list(request, response);
			
		}
	}
	
	private void list(HttpServletRequest request, HttpServletResponse response)
	{
		Page<MenuCategory> page =ControllerUtil.getModelObject(Page.class, request);

		Map<String,Object> searchObject = ControllerUtil.getSearchParams(request,MenuController.class.getName());
		
		//page = menuCategoryService.selectPageList(searchObject, page);
		
	}
	
	private void form(HttpServletRequest request, HttpServletResponse response)
	{
		
	}
}
